package com.czh.service.Provider;

import com.czh.dao.BaseDao;
import com.czh.dao.Provider.ProviderDao;
import com.czh.dao.Provider.ProviderDaoImpl;
import com.czh.pojo.Provider;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.List;

public class ProviderServiceImpl implements ProviderService{
    private ProviderDao providerDao = null;

    public ProviderServiceImpl() {
        this.providerDao = new ProviderDaoImpl();
    }

    @Override
    public List<Provider> getProviderList(String proCode, String proName) {
        List<Provider> providers;
        try {
            Connection con = BaseDao.getConnection();
            providers = providerDao.providerList(con, proCode, proName);
            BaseDao.closeConnect(con,null,null);
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }
        return providers;
    }
}
